﻿//========================================================================//
//      Copyright 2012, Smilodon Studio Inc.
//      All rights reserved.
//========================================================================//

/**
 *	color
 *      @author: CYS
 */



function rgba(r,g,b,a)
{
	return "rgba(" + ~~r +"," + ~~g + "," + ~~b + "," + a +")";
}

function hsla(h,s,l,a)
{
	return "hsla(" + ~~h +"," + ~~s + "%," + ~~l + "%," + a +")";
}

function rndColorRGB()
{
	return rgba(rnd(128)+127, rnd(128)+127, rnd(128)+127, 0.3);
}

function rndColorHSL()
{
	return hsla(rnd(280)+280, rnd(40)+60, rnd(60)+20, 0.88);
}

function rndColorHSL2()
{
	return hsla(rnd(80)+80, rnd(40)+60, rnd(6)+20, 1);
}

var Color = function(r, g, b, a)
{
	this.r = r || 1;
	this.g = g || 1;
	this.b = b || 1;
	this.a = a || 1;
}

Color.prototype.setRGB = function(r, g, b) {this.r = r; this.g = g; this.b = b;}

Color.prototype.getValue = function()
{
	return "rgba(" + ~~this.r +"," + ~~this.g + "," + ~~this.b + "," + this.a +")";
}

